#include "stdafx.h"
#include "core/Game.h"

#include <iostream>

int main(int argc, char** argv)
{
	Game::GameType  game_type = Game::CLIENT;
	if (argc>1) {
		if		(argv[1][0]=='s') game_type = Game::SERVER;
		else if (argv[1][0]=='c') game_type = Game::CLIENT;
	}
 	Game* game = Game::create(game_type);

	try {
		game->init();
		game->run(); 
	} 
	catch(std::exception & e) {
		std::cerr << "\n\n****************************************\n";
		std::cerr <<     "EXCEPTION:\n " << e.what();
		std::cerr <<     "****************************************";
		std::cin.get();
	}
	delete game;

    return 0;
}